package com.kancy.learn.rpc.rmi.server;

import com.kancy.learn.rpc.rmi.api.IMessageService;
import com.kancy.learn.rpc.rmi.service.impl.MessageServiceImpl;

import java.rmi.Naming;

/**
 * @author kancy
 * @version 1.0
 * @date 2019/1/31 10:54
 */
public class ServerApplication {

    public static void main(String[] args) {

        // 发布服务
        IMessageService service = null;
        try {
            service = new MessageServiceImpl();
            String url = "rmi://10.43.23.97:9001/service/message";
            Naming.bind(url, service);
            System.out.println(IMessageService.class.getName() + " 服务发布成功：" + url + "！");

        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
